If you're using OT native interfaces, you can change the variable using an ioctl call, as shown in the snippet below.
enum { kATalkFullSelfSend = MIOC_CMD(MIOC_ATALK, 47) }; static OSStatus OTSetSelfSend(EndpointRef ep, Boolean enable_self_send) { OSStatus result; result = OTIoctl(ep, kATalkFullSelfSend, (void *) enable_self_send); if (result > noErr) { result = noErr; } return result; }Note that, like the PSetSelfSend call, the ioctl returns the previous value of the self send variable as either 0 (it was previously disabled) or 1 (it was previously enabled). As in classic AppleTalk, it's rarely appropriate to restore the value of self send when you're done, so the code above maps both results to noErr.
The self send value is a Boolean, not a counter. For example, if the following sequence happens:
For this reason, the standard practice is to set self send if you need it and not attempt to restore it. Because many clients follow this convention, it's important that your program work even if self send is true.
Future versions of OT will most probably have self send always on for OT native
clients and loop-back packets will be filtered out only for classic clients if
PSetSelfSend wasn't called.